$OpenBSD: patch-buildtools_wafsamba_wafsamba_py,v 1.5 2016/04/25 08:13:41 jca Exp $

- allow the library version to be overriden
- make sure we don't clobber the version that ends up in tdb.pc

--- buildtools/wafsamba/wafsamba.py.orig	Fri Feb 19 22:02:02 2016
+++ buildtools/wafsamba/wafsamba.py	Sat Apr 23 18:40:25 2016
@@ -220,6 +220,13 @@ def SAMBA_LIBRARY(bld, libname, source,
     realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON'))
     link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON'))
 
+    saved_lib_version = vnum
+    if vnum is not None:
+        osvnum = os.getenv('LIB' + libname.replace('-', '_') + '_VERSION')
+        if osvnum:
+            print "Setup-specific version for library %s: %s" % (libname, osvnum)
+            vnum = osvnum
+
     # we don't want any public libraries without version numbers
     if (not private_library and target_type != 'PYTHON' and not realname):
         if vnum is None and soname is None:
@@ -328,7 +335,7 @@ def SAMBA_LIBRARY(bld, libname, source,
         t.link_name = link_name
 
     if pc_files is not None and not private_library:
-        bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
+        bld.PKG_CONFIG_FILES(pc_files, vnum=saved_lib_version)
 
     if (manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and
         bld.env['XSLTPROC_MANPAGES']):
